#ifndef __KillCockroachs__Cockroach__
#define __KillCockroachs__Cockroach__

#include "cocos2d.h"
#include "cocos-ext.h"
#include "Config.h"


USING_NS_CC;
USING_NS_CC_EXT;


class CockRoach : public CCSprite
{
	private:
		CockRoachStatus m_curentStatus;
		int m_level;
		
	public:


		CCPoint oldpos;

		/// 
		/// CHU THICH SO LUOC VE HAM CONTRUCTOR
		/// THAM SO 1 CHO HAM : postion
		/// THAM SO 2 CHO HAM : scale
		/// 
		/// Ham khoi tao con gian
		/// Voi tham so dau vao la vi tri xuat hien cua con gian (Random)
		/// Tham so scale xac dinh kich thuoc cua con gian
		///
		/// @author : HM QUAN
		/// time_create: 13/6/2014
		/// time_end: 13/6/2014
		///
		CockRoach(CCPoint p,float scale);

		//static CockRoach * create(CCPoint p,float scale);
		virtual bool init(CCPoint p,float scale);

		/// 
		/// CHU THICH SO LUOC VE HAM setStatus() va getStatus()
		/// THAM SO 1 CHO HAM : status
		/// 
		/// Ham set trang thai cho con gian
		/// Va tra ve trang thai cua con gian
		///
		/// @author : Quach Van Quyet
		/// time_create: 13/6/2014
		/// time_end: 13/6/2014
		///
		inline void setStatus(CockRoachStatus status) {m_curentStatus = status;};

		inline int getStatus() {return m_curentStatus;};


		/// 
		/// CHU THICH SO LUOC VE HAM setLevel() va getLevel()
		/// THAM SO 1 CHO HAM : level
		/// 
		/// Ham set level cua con gian
		///
		/// @author : Quach Van Quyet
		/// time_create: 16/6/2014
		/// time_end: 16/6/2014
		///
		inline void setLevel(int level) {m_level = level;};
		inline int getLevel() {return m_level;};


		/// 
		/// CHU THICH SO LUOC VE HAM CockRoachInit()
		/// THAM SO 1 CHO HAM : p
		/// THAM SO 2 CHO HAM : scale
		///
		/// Ham khoi tao vi tri va kich thuoc cua con gian
		///
		/// @author : Quach Van Quyet
		/// time_create: 13/6/2014
		/// time_end: 13/6/2014
		///
		void CockRoachInit(CCPoint p,float scale);

		/// 
		/// CHU THICH SO LUOC VE CAC HAM QUAN LY HOAT DONG CUA CON GIAN VA TRANG THAI CUA GAME
		///
		/// Bat dau game, ket thuc game, cap nhat diem, quan ly cac action cua con gian
		///
		/// @author : Quach Van Quyet
		/// time_create: 13/6/2014
		/// time_end: 13/6/2014
		///
		void play(); //tap con gian
		void updateEscape(); // cap nhat so con gian tron thoat
		void updateScore(); //tang diem cho con gian

		
		/// 
		/// Hieu ung chet cua con gian
		///
		/// Cac hieu ung ve hinh anh va am thanh khi con gian chet
		///
		/// @author : Quach Van Quyet
		/// time_create: 16/6/2014
		/// time_end: 16/6/2014
		///

		void fCockRoachAppear(); // Hieu ung xuat hien con gian
		void fCockRoachDisappear(); // con gian bien mat
		void fUpdateDieImage(); // Hieu cung con gian chet

		CCRepeatForever* fRunning(); // Hanh dong chay cua con gian

		void rotate(float t);

		float fRotateAngle();

		virtual void update(float t);

		void removeSelf(CCObject* sender);
};

#endif